package Job.dog.dog;

public class Dog {
    private String breed;
    private int age;
    private char sex;
    private String name;

    public String getBreed() {
        return breed;
    }
    public void setBreed(String breed) {
        this.breed = breed;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public char getSex() {
        return sex;
    }
    public void setSex(char sex) {
        if (sex == '雄' || sex == '雌'){
            this.sex = sex;
        }else {
            throw new RuntimeException("只能是雄和雌!!!");
        }

    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    public Dog(String breed, int age, char sex, String name) {
        this.setBreed(breed);
        this.setAge(age);
        this.setSex(sex);
        this.setName(name);
    }

    public Dog() {
    }

    public void cry(){
        System.out.print("狗狗一边叫,");
    }

    public void run(){
        System.out.println("一边跑");
    }

    @Override
    public String toString() {
        return "Dog{" +
                "品种='" + breed + '\'' +
                ", 年龄=" + age +
                ", 性别=" + sex +
                ", 名字='" + name + '\'' +
                '}';
    }
}
